cmake_minimum_required(VERSION 3.5)

project(P5 VERSION 0.1 LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets )#PrintSupport)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS PrintSupport REQUIRED)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(PROJECT_SOURCES
	main.cpp
	imageproccesor.cpp
	imageproccesor.h
)

qt_add_resources(${PROJECT_SOURCE_DIR}/source/pic.qrc)

add_executable(P5
	${PROJECT_SOURCES}
	showwidget.h showwidget.cpp
	source/pic.qrc
)

target_link_libraries(P5 PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::PrintSupport)

install(TARGETS P5 RUNTIME DESTINATION /opt/wlly)

if(QT_VERSION_MAJOR EQUAL 6)
    qt_finalize_executable(P5)
endif()

